//
// Created by lqk on 2022/2/21.
//

#ifndef QUADCEREBELLUM_PYBULLETCHEATERSENSORDRIVER_H
#define QUADCEREBELLUM_PYBULLETCHEATERSENSORDRIVER_H

#include "PeriodicTaskManager.h"
#include "PeriodicTask.h"
#include "SensorStructs.h"
#include "lcm/lcm-cpp.hpp"
#include "quad_bot/cheater_sensor_info_pb.hpp"

extern CheaterSensorInfo g_cheaterInfo;

class PyBulletCheaterSensorDriver:public PeriodicTask{
public:
    PyBulletCheaterSensorDriver(PeriodicTaskManager* taskManager,const float& period,const std::string& name,const std::string& subChannel):PeriodicTask(taskManager,period,name),m_subChannel(subChannel){}
    virtual void Init() override;
    virtual void RunOnce() override;
    virtual void PrintStatus() override;
private:
    virtual void CleanUp() override;
    void Callback(const lcm::ReceiveBuffer* rbuf,const std::string& channel,const quad_bot::cheater_sensor_info_pb* msg);

    lcm::LCM m_lcmSub;
    int m_lcmSubHandle=0;
    const std::string m_subChannel;
};


#endif //QUADCEREBELLUM_PYBULLETCHEATERSENSORDRIVER_H
